package routers

import (
    "cing.io/cing/internal/apiserver/services"
    "github.com/gin-gonic/gin"
)

func InitRoutes(router *gin.RouterGroup) {
    setTaskRoutes(router)
    setTaskTypeRoutes(router)
    setSingingRoutes(router)
}

func setTaskRoutes(router *gin.RouterGroup) {
    router.GET("/task/:namespace/:name", services.TaskService.GetTask)
    router.POST("/task", services.TaskService.CreateTask)
    router.PUT("/task", services.TaskService.UpdateTask)
    router.DELETE("/task/:namespace/:name", services.TaskService.DeleteTask)
}

func setTaskTypeRoutes(router *gin.RouterGroup) {
    router.GET("/tasktype/:name", services.TaskTypeService.GetTaskType)
    router.POST("/tasktype", services.TaskTypeService.CreateTaskType)
    router.PUT("/tasktype", services.TaskTypeService.UpdateTaskType)
    router.DELETE("/tasktype/:name", services.TaskTypeService.DeleteTaskType)
}

func setSingingRoutes(router *gin.RouterGroup) {
    router.POST("/feedback", services.FeedbackService.FeedBack)
}
